package com.lx.mybatis.mapper;

import com.lx.mybatis.entity.Bill;
import com.lx.mybatis.entity.BillItem;
import com.lx.mybatis.entity.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface BillMapper {
    @Results(
            id = "rm1",
            value = {
                    @Result(id = true, column = "id", property = "id"),
                    @Result(column = "id", property = "items",
                    //@Many一对多
                    many = @Many(fetchType = FetchType.LAZY,
                    select = "com.lx.mybatis.mapper.BillItemMapper.selectByBid"))
            }
    )
    @Select("select * from bill where type = #{type}")
    List<Bill> selectByType(String type);

    List<Bill> selectByType1(String type);
}
